home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 2010-02-07 | 64.8 KB | 1,829 lines
/*----------------------------------------------------------------------------\ | JSBalloon | |-----------------------------------------------------------------------------| | Created by Arkady (Alex) Lesniara | | (arkady@lesniara.com) | |-----------------------------------------------------------------------------| | Copyright (c) 2005 Arkady Lesniara | |-----------------------------------------------------------------------------| | This software is provided "as is", without warranty of any kind, express or | | implied, including but not limited to the warranties of merchantability, | | fitness for a particular purpose and noninfringement. In no event shall the | | authors or copyright holders be liable for any claim, damages or other | | liability, whether in an action of contract, tort or otherwise, arising | | from, out of or in connection with the software or the use or other | | dealings in the software. | \----------------------------------------------------------------------------*/ // create the base ANSW object if it does not exist. if (typeof ANSW=="undefined") { ANSW = new Object(); } ANSW.alert= function(msg){ // alert(msg) }; ANSW.console = function(msg){ //if(window.console) window.console.log(msg); }; ANSW.Init = function(nafid,cobrand) { ANSW.nafid = nafid; ANSW.cobrand = cobrand; }; /* Class: ANSW.Balloon Provides a flexible, encapsulated way to implement a passive feedback mechanism in a DHTML environment. Define and initialize this object globally, otherwise it will create a new instance each time you call it's constructor. Set up the object with an object array passed to the constructor or, once instantiated, with properties. See <Usage> for more. */ ANSW.Balloon = function() { var oldkeyup; this.oldkeyup = oldkeyup; var oldmousedown; this.oldmousedown = oldmousedown; var oldmouseup; this.oldmouseup = oldmouseup; var oldcontextmenu; this.oldcontextmenu = oldcontextmenu; var oldmousemove; this.oldmousemove = oldmousemove; var tmrIFrameGone; this.tmrIFrameGone = tmrIFrameGone; var blbWidth=200; this.blbWidth = blbWidth; this.showCloseBox=false; this.initBalloon = function() { if(arguments.length>0) { var oArg=arguments[0]; if(oArg.width!=null) { this.blbWidth=oArg.width; } this.width=this.blbWidth; } }; var childID; this.childID= childID; // Public Methods this.Show=Show; this.Hide=Hide; this.isVisible=isVisible; /* Function: Show Makes the instantiated balloon appear. Balloon content note: Because SELECT objects are what's known as windowed controles they need to be hidden when balloons are shown, otherwise they will always be on top (they ignore zIndex attribute). It is normally done automatically by this control. Sometimes, however, you may want to place a drop-down inside the balloon itself. To override this default behaviour add an balloonMember expando attirbute to the SELECT you are placing withing. - e.g. <SELECT id=select1 name=select1 balloonMember=true> Syntax: (start code) object.Show({[title:vTitle] [,message:vMessage] [,footer:vFooter] [,top:vTop] [,left:vLeft] [,anchor:vAnchor] [,icon:vIcon] [,query:vQuery] }); (end) Possible Values: vTitle - *string* Optional title text for the balloon. vMessage - *string* Optional. Message body for the balloon. vFooter - *string* Optional. Test displayed at the bottom of the balloon on a separate line. vTop - *integer* Optional. Offset from the top of the screen or top of an anchor. vLeft - *integer* Optional. Offset from the left of the screen or left of an anchor. vAnchor - *object* Optional. Reference to the object that the balloon should use as reference for location. vIcon - *string* Optional. Possible icon values may include one of the values below (case sensitive): - Exclaim - pre-defined, triangle with an exclamation point. - Stop - pre-defined, red circle with a white x inside. - Info - pre-defined, white balloon with a letter "i" inside *Default* - Help - a question mark inside a blue circle. - a relative path to a custom icon. vQuery - *query string* Examples: - balloonObj.Show({title:'JavaScript Balloon Example',message:'This is an example of a JSBalloon object. It\'s primary application is to provide a modeless feedback to DHTML applications.',anchor:tableCellObj, icon:'Info'}); - balloonObj1.Show({title:'JavaScript Balloon Example',message:'This is an example of a JSBalloon object. It\'s primary application is to provide a modeless feedback to DHTML applications.',anchor:tableCellObj}); - balloonObj2.Show({message:'This is an example of a JSBalloon object. It\'s primary application is to provide a modeless feedback to DHTML applications. ',anchor:tableCellObj}); */ function Show() { var title; var btop=0, bleft=0; var atop=0, aleft=0; var anchor; var direction='SE'; var query =''; var nafid=''; var cobrand=''; var nohook = false; var parent = null; var ads=0; var mydoc= ANSW.isFirefoxExtension ? window.content.document : document; blbWidth=String(this.width) + "px"; // Updates if(Show.arguments.length>0) { var oArg=Show.arguments[0]; if(oArg.title!=null) { title=oArg.title; } if(oArg.top!=null) { btop=oArg.top; } if(oArg.left!=null) { bleft=oArg.left; } if(oArg.anchor!=null) { anchor=oArg.anchor; atop=getTop(anchor); aleft=getLeft(anchor); } if(oArg.query!=null) { query=oArg.query; } if(oArg.nafid!=null) { nafid=oArg.nafid; } if(oArg.cobrand!=null) { cobrand=oArg.cobrand; } if(oArg.nohook!=null) { nohook= true; } if(oArg.parent!=null) { parent= oArg.parent; } if(oArg.ads!=null) { ads= oArg.ads; } } if (parent) { mydoc = parent.parentNode; mydoc= mydoc.parentNode; ANSW.doc = mydoc; } var formerBalloon = mydoc.getElementById("AnswersBalloon"); if (ANSW.doc) formerBalloon = ANSW.doc.getElementById("AnswersBalloon"); ANSW.alert(" ANSW.doc= "+ANSW.doc); ANSW.alert(" formerBalloon= "+formerBalloon); ANSW.alert("btop = " + btop); if (bleft == -1 && btop == -1) { var answertip = ANSW.doc.getElementById("Answertip"); answertip.innerHTML= '<DIV class="answering" >Answering...</DIV>'; var answerads = ANSW.doc.getElementById("AnswersAds"); var local =""; if (this.answersURL.indexOf(":8080")!= -1) local = "/answers"; if (answerads !=null) { if (typeof cobrand != "undefined" && cobrand!=null) { answerads.src= this.answersURL + local + '/main/tip2.jsp?s=' + query +"&wt=1"+"&cobrand="+cobrand; } if (typeof nafid != "undefined" && nafid!=null) { answerads.src +="&nafid="+nafid; } if (ads>0) answerads.src =""; } return; } else { this.balloonDIV = mydoc.createElement("DIV"); this.balloonDIV.id="AnswersBalloon"; this.balloonDIV.style.width=String(blbWidth); this.balloonDIV.style.position="absolute"; this.balloonDIV.style.visibility="hidden"; this.balloonDIV.style.zIndex=99999; this.balloonDIV.style.textAlign="left"; } // Figure out the best direction for the pointer // Assume SE var ret=this.balloonInfrastructure(balloonBody( title, this.showCloseBox,cobrand),this.JSBalloonPath,direction,query,nafid,cobrand,ads); // check if the object is already initialized if(formerBalloon) { ANSW.b5.Hide(); this.childID=ANSW.doc?ANSW.doc.body.replaceChild(this.balloonDIV,formerBalloon):mydoc.body.replaceChild(this.balloonDIV,formerBalloon); if (this.ifrlayer) this.ifrlayer.replace(this.balloonDIV); } else { ANSW.alert("parent= "+parent); if (parent) this.childID=parent.appendChild(this.balloonDIV); else this.childID=mydoc.body.appendChild(this.balloonDIV); if (this.ifrlayer) this.ifrlayer.make(this.balloonDIV); } this.balloonDIV.innerHTML=ret; var balloonLeft; var balloonTop; if(anchor!=null) { balloonLeft = aleft+bleft; balloonTop = atop-this.balloonDIV.offsetHeight+btop; // problem here first time with firefox 1.5 } else { balloonLeft = bleft; balloonTop = btop -this.balloonDIV.offsetHeight ; } ANSW.alert("balloonLeft= " + balloonLeft + " balloonTop= " + balloonTop); var bAdjustedLeft=balloonLeft; //parseInt(balloonDIV.style.left, 10); var showSE; ANSW.alert("bAdjustedLeft= " + bAdjustedLeft); ANSW.alert("balloonDIV.offsetWidth= " + this.balloonDIV.offsetWidth); ANSW.alert("balloonDIV.offsetHeight= " + this.balloonDIV.offsetHeight); var clientWidth; var clientHeight; var scrollLeft; var scrollTop; if (self.innerHeight) // all except Explorer { clientWidth = self.innerWidth; clientHeight = self.innerHeight; } else if (mydoc.documentElement && mydoc.documentElement.clientHeight) // Explorer 6 Strict Mode { clientWidth = mydoc.documentElement.clientWidth; clientHeight = mydoc.documentElement.clientHeight; } else if (mydoc.body) // other Explorers { clientWidth = mydoc.body.clientWidth; clientHeight = mydoc.body.clientHeight; } if (self.pageYOffset) // all except Explorer { scrollLeft = self.pageXOffset; scrollTop = self.pageYOffset; } else if (mydoc.documentElement && mydoc.documentElement.scrollTop) // Explorer 6 Strict { scrollLeft = mydoc.documentElement.scrollLeft; scrollTop = mydoc.documentElement.scrollTop; } else if (mydoc.body) // all other Explorers { scrollLeft = mydoc.body.scrollLeft; scrollTop= mydoc.body.scrollTop; } ANSW.alert("clientWidth= " + clientWidth ); ANSW.alert("clientHeight= " + clientHeight ); ANSW.alert("scrollLeft= " + scrollLeft ); ANSW.alert("scrollTop= " + scrollTop ); var check = bAdjustedLeft - 0 + this.balloonDIV.offsetWidth - scrollLeft + 20; ANSW.alert("check= " + check); if(clientWidth - 0 < check - 0) { direction='SW'; ANSW.alert("SW"); ret=this.balloonInfrastructure(balloonBody( title, this.showCloseBox,cobrand),this.JSBalloonPath, direction,query,nafid,cobrand,ads); this.balloonDIV.innerHTML=ret; balloonLeft = bAdjustedLeft-this.balloonDIV.offsetWidth; ANSW.alert("balloonLeft = " + balloonLeft); showSE=false; } else { direction='SE'; showSE=true; } ANSW.alert("balloonLeft= " + balloonLeft + " balloonTop= " + balloonTop); if(balloonTop < scrollTop) { if(showSE) { direction='NE'; ret=this.balloonInfrastructure(balloonBody( title, this.showCloseBox,cobrand), this.JSBalloonPath,direction,query,nafid,cobrand,ads); this.balloonDIV.innerHTML=ret; } else { direction='NW'; ret=this.balloonInfrastructure(balloonBody( title, this.showCloseBox,cobrand), this.JSBalloonPath, direction,query,nafid,cobrand,ads); this.balloonDIV.innerHTML=ret; } balloonTop += this.balloonDIV.offsetHeight; if(anchor!=null) { balloonTop += anchor.offsetHeight; if (document.all && !this.isOpera) // only for IE { balloonTop += this.balloonDIV.offsetParent.scrollTop; } } } else { ANSW.alert("1left1= " + balloonLeft + " top1= " + balloonTop); } if(this.showCloseBox) { if(direction=='SE' || direction=='SW') { btnClose=this.balloonDIV.children[0].children[0].children[1].children[0].children[0].children[0].children[0].children[2].children[0]; } else { btnClose=this.balloonDIV.children[0].children[0].children[2].children[0].children[0].children[0].children[0].children[2].children[0]; } btnClose.onclick=this.Hide; } ANSW.alert("3balloonLeft= " + balloonLeft + " balloonTop= " + balloonTop); // Adjust all scrollers except for opera if (!this.isOpera) { if (anchor) { var scrollOffsets=ScrollOffsets(anchor); balloonTop -= scrollOffsets[0]; balloonLeft -= scrollOffsets[1]; } } if (balloonLeft<0 || balloonTop<0 || (btop + this.balloonDIV.offsetHeight - scrollTop - clientHeight)>0 && direction.indexOf('N')==0) { var athook = ANSW.doc ? ANSW.doc.getElementById("AnswerTipHook") : mydoc.getElementById("AnswerTipHook"); if (athook) { athook.style.visibility='hidden'; } balloonTop = scrollTop; if (clientWidth<=1025) // center the Answertip balloonLeft = clientWidth/2 -this.balloonDIV.offsetWidth/2+scrollLeft; else { if (direction=='NE' || direction=='SE') balloonLeft += 50; else balloonLeft -= 50; } } else { if (ANSW.isFirefoxExtension) { if (direction.indexOf("E")>0) // East correction -20 West correction +20 balloonLeft -=20; else balloonLeft +=20; if(direction=='SE' || direction=='SW') balloonTop -=5; else balloonTop +=5; } else { if(direction=='NW' || direction=='SW') balloonLeft +=15; if(direction=='NW' || direction=='NE') balloonTop +=10; } } if(nohook) { var athook = ANSW.doc ? ANSW.doc.getElementById("AnswerTipHook") : mydoc.getElementById("AnswerTipHook"); if (athook) { athook.style.visibility='hidden'; } } ANSW.alert("leftb= " + this.balloonDIV.style.left + " topb= " + this.balloonDIV.style.top); ANSW.alert("4balloonLeft= " + balloonLeft + " balloonTop= " + balloonTop); ANSW.alert("4this.balloonDIV.offsetHeight= " + this.balloonDIV.offsetHeight + " top= " + top + " mydoc.body.clientHeight= " + mydoc.body.clientHeight); this.balloonDIV.style.top=balloonTop+"px"; this.balloonDIV.style.left=balloonLeft+"px"; ANSW.alert("lefta= " + this.balloonDIV.style.left + " topa= " + this.balloonDIV.style.top); ANSW.alert("direction=" + direction); this.balloonDIV.direction=direction; // kludge for bug in FF-Mac - scrollbar stays when window hidden var answertip = ANSW.doc ? ANSW.doc.getElementById("Answertip") : mydoc.getElementById("Answertip"); if (answertip) answertip.style.overflow="auto"; // Hide any overlapping selects if (this.ifrlayer) { this.ifrlayer.move(this.balloonDIV); this.ifrlayer.resize(this.balloonDIV); } // ieFix(); comment this line to fix case 12802: webtip is malformed on CBS (on DR) in IE7 // Show balloon this.balloonDIV.style.visibility='visible'; ANSW.alert(this.balloonDIV.style.width); if(ANSW.b5.isFirefox && typeof deconcept!="undefined") { SuppressFlash(); } this.tmrIFrameGone=setInterval(this.IFrameGone,400); } function IFrameGone() { var mydoc= ANSW.isFirefoxExtension ? window.content.document : document; var ac = ANSW.doc ? ANSW.doc.getElementById("answertipClose") : mydoc.getElementById("answertipClose"); if (ac) { var params=ac.innerHTML; if (params=="close") { ac.innerHTML = ""; ANSW.b5.Hide(); } else if (params=="options") { ac.innerHTML = ""; var local =""; if (ANSW.b5.answersURL.indexOf(":8080")!= -1) local = "/answers" if(ANSW.isFirefoxExtension) window.openDialog("chrome://answers/content/options.xul", "1-Click Answers Options", "centerscreen,chrome,modal"); else window.open(ANSW.b5.answersURL + local +"/main/transoptform?gwp=11"); } else if (params.indexOf("checklang")==0) { ac.innerHTML = ""; if (params.indexOf("true")>-1) ANSW.b5.checklang(true); else ANSW.b5.checklang(false); } else if (params=="personalize") { ac.innerHTML = ""; ANSW.b5.Personalize(); } else if (params.indexOf('?')==0) { ac.innerHTML = ""; params=params.replace(/&/g,"&"); if (params.indexOf("&ok=1")>-1) { params+=ANSW.b5.getPrefs(); } ANSW.b5.dymtip(params); } } } this.IFrameGone = IFrameGone; function isVisible() { if (this.balloonDIV) { if(this.balloonDIV.style.visibility=='hidden') return false; else return true; } else return false; } /* Function: Hide Hide a visible balloon. Call this function to immediately initiate the hiding of the instantiated balloon with the predefined transition in <transHideFilter> depending on the setting of <transHide>. */ function Hide() { clearInterval(this.tmrIFrameGone); moveme_onmouseup(); // to remove the mousemove listener if(!this.balloonDIV || this.balloonDIV.style.visibility=='hidden') { return; } this.balloonDIV.style.visibility='hidden'; // kludge for bug in FF-Mac - scrollbar stays when window hidden var mydoc= ANSW.isFirefoxExtension ? window.content.document : document; var answertip = ANSW.doc ? ANSW.doc.getElementById("Answertip") : mydoc.getElementById("Answertip"); if (answertip) answertip.style.overflow="hidden"; var answertipMore = ANSW.doc ? ANSW.doc.getElementById("AnswertipMore") : mydoc.getElementById("AnswertipMore"); if (answertipMore==null || typeof (answertipMore) == "undefined") answertipMore = ANSW.doc ? ANSW.doc.getElementById("AnswertipCBSMore") : mydoc.getElementById("AnswertipCBSMore"); if (answertipMore) { answertipMore.style.visibility="hidden"; } var AnswersAIC = ANSW.doc ? ANSW.doc.getElementById("AnswersAIC") : mydoc.getElementById("AnswersAIC"); if (AnswersAIC) AnswersAIC.style.visibility="hidden"; if (ANSW.b5.ifrlayer) ANSW.b5.ifrlayer.hide(this.balloonDIV); if(ANSW.b5.isFirefox && typeof deconcept!="undefined") RestoreFlash(); } function ObjectOverlap(obj1, obj2) { var obj1TopX = getLeft(obj1); var obj1TopY = getTop(obj1); var obj1BottomX = getLeft(obj1)+obj1.offsetWidth; var obj1BottomY = getTop(obj1)+obj1.offsetHeight; var obj2TopX = getLeft(obj2); var obj2TopY = getTop(obj2); var obj2BottomX = getLeft(obj2)+obj2.offsetWidth; var obj2BottomY = getTop(obj2)+obj2.offsetHeight; var overlapOnX = (obj1TopX < obj2BottomX && obj2TopX < obj1BottomX); var overlapOnY = (obj1TopY < obj2BottomY && obj2TopY < obj1BottomY); return (overlapOnX && overlapOnY); } //Positioning functions function getObjLeft(anObject) { return (anObject.offsetParent ? (getObjLeft(anObject.offsetParent) + anObject.offsetLeft) : anObject.offsetLeft); } function getObjTop(anObject) { return(anObject.offsetParent ? (getObjTop(anObject.offsetParent) + anObject.offsetTop) : anObject.offsetTop); } function getLeft(anObject) { return(getObjLeft(anObject)); } function getTop(anObject) { return(getObjTop(anObject)); } function InsideObject(obj,x,y) { var objTopY =getTop(obj); var objTopX = getLeft(obj); var objBottomX = objTopX + obj.offsetWidth; var objBottomY = objTopY + obj.offsetHeight; var xInside = (x < objBottomX+4 && x > objTopX-1); var yInside = (y < (objBottomY+10) && y > (objTopY-10)); return (xInside && yInside); } function ScrollOffsets(anchor) { var aryScrolls = new Array(0,0); try { var parentElem=anchor.parentElement; while(parentElem!=null) { if(parentElem.scrollTop!=null) { aryScrolls[0]+=parseInt(parentElem.scrollTop, 10); aryScrolls[1]+=parseInt(parentElem.scrollLeft, 10); } parentElem=parentElem.parentElement; } } catch(ex) { // continue } return aryScrolls; } function addHook(path,dir,cobrand) { var imageName; var marginleft; var top; var height; var width; switch(dir) { case "SE": imageName="hook-bottomL"; marginleft="25px"; height="29px"; width="70px"; if (ANSW.b5.isIE6) top="-18px"; else top="-15px"; break; case "SW": imageName="hook-bottomR"; marginleft="400px"; height="29px"; width="70px"; if (ANSW.b5.isIE6) top="-19px"; else top="-16px"; break; case "NE": imageName="hook-topL"; marginleft="25px"; height="24px"; width="67px"; top="10px"; break; case "NW": imageName="hook-topR"; marginleft="400px"; height="24px"; width="67px"; top="10px"; break; default: alert("bad direction"); } var ret= '<DIV id="AnswerTipHook" style="background-image: url('+path+'/main/images/'+imageName +'.gif);width:'+width+';height:'+height+';margin-left:' +marginleft +';position:relative;top:'+top+';"></DIV>'; return ret; } function addCBSBalloon(path,body,sponsor) { var balloon = '<div class="popupFrameA" id="popup_FrameA">'+ '<div class="popupHeader" id="popup_header">'+ '<div class="popupHeaderInner" id="AnswersHandle0" style="cursor:move;" handlefor="AnswersBalloon">'+ '<div class="popupHeader1" style="margin-right:-10px;margin-left:-6px;width:250px;'; balloon +=ANSW.Trigger.isSafari3?'width:247px;">':'">' ; balloon += '<div style="float:left;margin-top:5px;color:white;" >Powered by</div>'+ '<div><a style="float:left;" href="'+path+'"><img id="AnswersLogoCBSImage" style="position:relative;" border="0" align="top" alt="Visit Answers.com" src="'+path+'/main/images/answers_cbs_logo.gif"/></a></div>'+ '<a style="float:left;cursor:hand;cursor:pointer;" onclick="var ac = document.getElementById(\'answertipClose\'); if (ac) ac.innerHTML=\'close\'; else window.status=\'close\'; return true;" ><img id="AnswersCBSCloseImage" border="0" align="top" alt="Close" src="'+path+'/main/images/close.gif"/></a>' + '</div>'+ '<span class="AnswersHeader2" >Instant Information </span>'+ '</div>'+ '<div id="Answers_frame" class="AnswersContentFrame1">' + body+ '</div>'+ '<div class="AnswersFooter" id="popup_footer">'+ sponsor+ '</div>'+ '</div>'+ '</div>'; return balloon; } function addAdsBalloon(path,body,sponsor,ads) { var tracking = '' ; if (ads>0) tracking=ANSW.isFirefoxExtension?'?initiator=FFANS':'?initiator=WANS'; else tracking='?initiator=WALLST'; var balloon = '<div class="AnswersHeaderW" id="AnswersHeader_W">'+ '<div class="AnswersHeaderInner" id="AnswersHandle0" style="cursor:move;" handlefor="AnswersBalloon">'+ '<div class="AnswersHeader1">'+ '<a style="float:right;" onclick="var ac = document.getElementById(\'answertipClose\');if (ac) ac.innerHTML=\'close\'; else window.status=\'close\'; return true;" ><img id="AnswersCloseImage" style="margin-right:10px;position:relative;cursor:hand;cursor:pointer;" border="0" align="top" alt="Close" src="'+path+'/main/images/close.gif"/></a>' + '<a id="AnswertipMore" target="AnswersQueryWindow" onclick="var ac = document.getElementById(\'answertipClose\'); if (ac) ac.innerHTML=\'close\'; else window.status=\'close\';return true;" style="float:right;text-decoration:none;visibility:hidden;padding-right:10px;margin-top:9px;cursor:hand;" ><span class="AnswersHeader3"> Read more >>  </span></a>'; balloon+= ANSW.isFirefoxExtension?'<a id="AnswertipOptions" onclick="var ac = document.getElementById(\'answertipClose\'); if (ac) ac.innerHTML=\'options\'; else window.status=\'options\';return true;" style="float:right;text-decoration:none;padding-right:10px;margin-top:9px;cursor: hand;cursor:pointer;" ><span class="AnswersHeader3"> Options >>  </span></a>':''; balloon+= (ads>0)?'</div>':'<a href="http://www.wallst.net"><img id="WALLSTLogoImage" border="0" align="top" alt="Visit WallSt.net" src="'+path+'/main/images/answers_wallst.gif"/></a></div>'; balloon+= '<div><a style="float:left;" href="'+path+tracking+'"><img id="AnswersLogoImage" style=";" border="0" align="top" alt="Visit Answers.com" src="'+path+'/main/images/answers-logo.gif"/></a></div>'+ '</div>'+ '<div id="Answers_frame" class="AnswersContentFrame">' + body+ '</div>'+ '<div class="AnswersFooter" id="Answers_footer">'+ sponsor+ '</div>'+ '</div>'; return balloon; } function addAnswersBalloon(path,body,sponsor) { var tracking = ANSW.isFirefoxExtension?'?initiator=FFANS':'?initiator=WANS'; var balloon = '<div class="AnswersHeader" >'+ '<div class="AnswersHeaderInner" id="AnswersHandle0" style="cursor:move;" handlefor="AnswersBalloon">'+ '<div class="AnswersHeader1">'+ '<a style="float:right;" onclick="var ac = document.getElementById(\'answertipClose\'); if (ac) ac.innerHTML=\'close\'; else window.status=\'close\'; return true;" ><img id="AnswersCloseImage" style="margin-right:10px;position:relative;cursor:hand;cursor:pointer;" border="0" align="top" alt="Close" src="'+path+'/main/images/close.gif"/></a>' + '<a id="AnswertipMore" target="AnswersQueryWindow" onclick="var ac = document.getElementById(\'answertipClose\'); if (ac) ac.innerHTML=\'close\'; else window.status=\'close\';return true;" style="float:right;text-decoration:none;visibility:hidden;padding-right:10px;margin-top:9px;cursor:hand;cursor:pointer;" ><span class="AnswersHeader3"> Read more >>  </span></a>'; balloon+= ANSW.isFirefoxExtension?'<a id="AnswertipOptions" onclick="var ac = document.getElementById(\'answertipClose\'); if (ac) ac.innerHTML=\'options\'; else window.status=\'options\';return true;" style="float:right;text-decoration:none;padding-right:10px;margin-top:9px;cursor:hand;cursor:pointer;" ><span class="AnswersHeader3"> Options >>  </span></a>':''; balloon+= '</div>'+ '<div><a style="float:left;cursor:hand;cursor:pointer;" href="'+path+tracking+'"><img id="AnswersLogoImage" style=";" border="0" align="top" alt="Visit Answers.com" src="'+path+'/main/images/answers-logo.gif"/></a></div>'+ '</div>'+ '<div id="Answers_frame" class="AnswersContentFrame">' + body+ '</div>'+ '<div class="AnswersFooter" id="Answers_footer">'+ sponsor+ '</div>'+ '</div>'; return balloon; } function addAnswersBalloon2(path,body,sponsor) { var tracking = ANSW.isFirefoxExtension?'?initiator=FFANS':'?initiator=WANS'; var balloon = '<div class="AnswersHeaderB" >'+ '<div class="AnswersHeaderInner" id="AnswersHandle0" style="cursor:move;" handlefor="AnswersBalloon">'+ '<div class="AnswersHeader1">'+ '<a style="float:right;" onclick="var ac = document.getElementById(\'answertipClose\'); if (ac) ac.innerHTML=\'close\'; else window.status=\'close\'; return true;" ><img id="AnswersCloseImage" style="margin-right:10px;position:relative;cursor:hand;cursor:pointer;" border="0" align="top" alt="Close" src="'+path+'/main/images/close.gif"/></a>' + '<a id="AnswertipMore" target="AnswersQueryWindow" onclick="var ac = document.getElementById(\'answertipClose\'); if (ac) ac.innerHTML=\'close\'; else window.status=\'close\';return true;" style="float:right;text-decoration:none;visibility:hidden;padding-right:10px;margin-top:9px;cursor:hand;cursor:pointer;" ><span class="AnswersHeader3"> Read more >>  </span></a>'; balloon+= ANSW.isFirefoxExtension?'<a id="AnswertipOptions" onclick="var ac = document.getElementById(\'answertipClose\'); if (ac) ac.innerHTML=\'options\'; else window.status=\'options\';return true;" style="float:right;text-decoration:none;padding-right:10px;margin-top:9px;cursor:hand;cursor:pointer;" ><span class="AnswersHeader3"> Options >>  </span></a>':''; balloon+= '</div>'+ '<div><a style="float:left;cursor:hand;cursor:pointer;" href="'+path+tracking+'"><img id="AnswersLogoImage" style=";" border="0" align="top" alt="Visit Answers.com" src="'+path+'/main/images/answers-logo.gif"/></a></div>'+ '</div>'+ '<div id="Answers_frame" class="AnswersContentFrame">' + body+ '</div>'+ '<div class="AnswersFooter" id="Answers_footer">'+ sponsor+ '</div>'+ '</div>'; return balloon; } function addAnswersBalloon3(path,body,sponsor) { var tracking = ANSW.isFirefoxExtension?'?initiator=FFANS':'?initiator=WANS'; var balloon = '<div class="AnswersHeaderA" >'+ '<div class="AnswersHeaderInner" id="AnswersHandle0" style="cursor:move;" handlefor="AnswersBalloon">'+ '<div class="AnswersHeader1">'+ '<a style="float:right;" onclick="var ac = document.getElementById(\'answertipClose\'); if (ac) ac.innerHTML=\'close\'; else window.status=\'close\'; return true;" ><img id="AnswersCloseImage" style="margin-right:10px;position:relative;cursor:hand;cursor:pointer;" border="0" align="top" alt="Close" src="'+path+'/main/images/close.gif"/></a>' + '<a id="AnswertipMore" target="AnswersQueryWindow" onclick="var ac = document.getElementById(\'answertipClose\'); if (ac) ac.innerHTML=\'close\'; else window.status=\'close\';return true;" style="float:right;text-decoration:none;visibility:hidden;padding-right:10px;margin-top:9px;cursor:hand;cursor:pointer;" ><span class="AnswersHeader3"> Read more >>  </span></a>'; balloon+= ANSW.isFirefoxExtension?'<a id="AnswertipOptions" onclick="var ac = document.getElementById(\'answertipClose\'); if (ac) ac.innerHTML=\'options\'; else window.status=\'options\';return true;" style="float:right;text-decoration:none;padding-right:10px;margin-top:9px;cursor:hand;cursor:pointer;" ><span class="AnswersHeader3"> Options >>  </span></a>':''; balloon+= '</div>'+ '<div><a style="float:left;cursor:hand;cursor:pointer;" href="'+path+tracking+'"><img id="AnswersLogoImage" style=";" border="0" align="top" alt="Visit Answers.com" src="'+path+'/main/images/answers-logo.gif"/></a></div>'+ '</div>'+ '<div id="Answers_frame" class="AnswersContentFrame">' + body+ '</div>'+ '<div class="AnswersFooter" id="Answers_footer">'+ sponsor+ '</div>'+ '</div>'; return balloon; } function addAnswersBalloon4(path,body) { var tracking = ANSW.isFirefoxExtension?'?initiator=FFANS':'?initiator=WANS'; var balloon = '<div class="AnswersHeaderC" >'+ '<div class="AnswersHeaderInner" id="AnswersHandle0" style="cursor:move;" handlefor="AnswersBalloon">'+ '<div class="AnswersHeader4">'+ '<a style="float:right;" onclick="var ac = document.getElementById(\'answertipClose\'); if (ac) ac.innerHTML=\'close\'; else window.status=\'close\'; return true;" ><img id="AnswersCloseImage" style="margin-right:10px;position:relative;cursor:hand;cursor:pointer;" border="0" align="top" alt="Close" src="'+path+'/main/images/close.gif"/></a>' + '<a id="AnswertipMore" target="AnswersQueryWindow" onclick="var ac = document.getElementById(\'answertipClose\'); if (ac) ac.innerHTML=\'close\'; else window.status=\'close\';return true;" style="float:right;text-decoration:none;visibility:hidden;padding-right:10px;margin-top:9px;cursor:hand;cursor:pointer;" ><span class="AnswersHeader3"> <u>More</u>  </span></a>'; balloon+= ANSW.isFirefoxExtension?'<a id="AnswertipOptions" onclick="var ac = document.getElementById(\'answertipClose\'); if (ac) ac.innerHTML=\'options\'; else window.status=\'options\';return true;" style="float:right;text-decoration:none;padding-right:10px;margin-top:9px;cursor:hand;cursor:pointer;" ><span class="AnswersHeader3"> Options >>  </span></a>':''; balloon+= '</div>'+ '<div><a style="float:left;cursor:hand;cursor:pointer;" href="'+path+tracking+'"><img id="AnswersLogoImage1" style=";" border="0" align="top" alt="Visit Answers.com" src="'+path+'/main/images/answers-logo.png"/></a></div>'+ '</div>'+ '<div id="Answers_frame" class="AnswersContentFrame">' + body+ '</div>'+ '<div class="AnswersFooter" id="Answers_footer">'+ '<TR cellpadding=0 cellspacing=0><TD>'+ '<div style="width: 540px; height: 22px; float: left; margin-top: 6px; color: yellow; font-size: 9pt; text-align: center;">'+ '<u><b><a style="color:yellow;" href="/main/answertips.jsp?lid=AnswerTip_enable&lpos=ATip_bottom">AnswerTips</a></u> - you can double-click on any word on your page.</b>'+ '</DIV> </TD></TR>'+ '</div>'+ '</div>'; return balloon; } function ieFix(){ // also some css specific to IE to work around IE bugs if(document.all){ var popupHeaderInner = document.getElementById('popup_header'); if (popupHeaderInner) { popupHeaderInner.style['margin'] = '0px 8px 18px 8px'; popupHeaderInner.style['width'] = '465px'; popupHeaderInner.style['padding-top'] = '8px'; } var popupFooter = document.getElementById('popup_footer'); if (popupFooter) popupFooter.style['margin-right'] = '4px'; // To add a shadow, use this. Comment out to disable var popupFrameA = document.getElementById('popup_FrameA'); if (popupFrameA) { popupFrameA.style['background-image'] = 'url(http://wwwimage.cbsnews.com/common/images/v2/popup_shadow.jpg)'; popupFrameA.style['background-repeat'] = 'no-repeat'; } } } function addBalloon(path,dir,cobrand,body,sponsor,ads,nafid) { if (cobrand=="cbs") return addCBSBalloon(path,body,sponsor); else { var ballon; switch(cobrand) { case "wallst": ballon = addAdsBalloon(path,body,sponsor,0); break; default: ballon = addAnswersBalloon(path,body,sponsor); break; } if (ads>0) ballon = addAdsBalloon(path,body,sponsor,ads); if (nafid==100) ballon = addAdsBalloon(path,body,sponsor,2); if (ANSW.aic==1) ballon = addAnswersBalloon3(path,body,sponsor); if (ANSW.aic==2) ballon = addAnswersBalloon4(path,body); return (dir.indexOf("N")>-1?addHook(path,dir,cobrand):'')+ ballon+ (dir.indexOf("S")>-1?addHook(path,dir,cobrand):''); } } // Rendering functions function balloonInfrastructure(body, path,direction,query,nafid,cobrand,ads) { var ret; var local =""; var url=""; var sponsor=""; if (this.answersURL.indexOf(":8080")!= -1) local = "/answers" if (typeof(cobrand)=="undefined" || !cobrand) cobrand=''; var adHeight="22px" if (typeof nafid != "undefined" && nafid!=null) { switch(nafid) { case 5: //JPost adHeight="62px"; break; case 100: //MTVU adHeight="62px"; break; default: adHeight="22px"; break; } } if (typeof cobrand != "undefined") { switch(cobrand) { case "cbs": //cbs with ads adHeight="62px"; break; case "wallst": adHeight="60px"; if (ANSW.b5.isIE) adHeight +=";margin-top:-1px;" break; default: break; } } if (ads==0) url = this.answersURL + local + '/main/tip2.jsp?s=' + encodeURIComponent(query) +'&wt=1&nafid=' + nafid +'&cobrand=' + cobrand ; else adHeight="61px"; sponsor='<TR cellpadding=0 cellspacing=0><TD>'+ '<DIV style="width:471px;height:'+adHeight+';float:left;">'+ '<iframe id="AnswersAds" type="content" scrolling="no" FRAMEBORDER="0" allowTransparency="true" style="padding:0px;border:0px;width:100%;height:'+adHeight+'" src="'+url +'"></iframe>'+ '</DIV> </TD></TR>'; return addBalloon(path,direction,cobrand,body,sponsor,ads,nafid); } this.balloonInfrastructure = balloonInfrastructure; function balloonBody(title, showCloseBox,cobrand) { var body=""; if (typeof(cobrand)=="undefined" || !cobrand) cobrand=''; var ret= '<table id="Balloontable2'+cobrand+'" class="donotmoveme" style="width:480px;float:left;"><TR><TD> <DIV id="Answertip" style="overflow-x:hidden;overflow:auto;height:'; ret +=(cobrand=="cbs")?'228px;background-color:white;':(ANSW.aic==1)?'305px;':(ANSW.aic==2)?'305px;':'235px;'; ret +=ANSW.aic==1?'width:495px;">':ANSW.aic==2?'width:563px;">':'width:473px;">'; ret += body + '</DIV> <DIV id="answertipClose" style="display:none;" ></DIV></TD></TR></table>'; return ret; } function SendQuery(obj,topic,nohook) { var top = getTop(obj); var left = getLeft(obj); var query = obj.innerHTML.replace(/<br>/gi," ").replace(/<[^>]+>/g,""); this.FireQuery(query,top,left,-1,null,topic,nohook); return false; } this.SendQuery = SendQuery; function dymtip(params) { var mydoc= ANSW.isFirefoxExtension ? window.content.document : document; var tmp=mydoc.getElementById('perdymtip'); params +=(params && typeof params!="undefined" && params.length>0)?"&":"?"; if (tmp) { if (ANSW.isFirefoxExtension) params +="o=0&gwp=22"; else params +="o=2&gwp=21"; params += (document.charset ? ("&encoding=" + document.charset) : ""); params += "&dym="+encodeURIComponent(tmp.innerHTML.replace(/\'/g,'%27').replace(/\n/g,'%20')) ; } loadScript("answertip.jsp","answertipScript",null,params); } this.dymtip = dymtip; function Personalize() { var params ="" ; if (ANSW.isFirefoxExtension) params +="?o=0&gwp=22"; else params +="?o=2&gwp=21"; params +="&per=1"; var mydoc= ANSW.isFirefoxExtension ? window.content.document : document; var answertipJS = mydoc.getElementById("answertipScript"); var encoding = (document.charset ? ("&encoding=" + document.charset) : ""); params += encoding; if (answertipJS && answertipJS.src) { params +="&prevurl="; params +=encodeURIComponent(answertipJS.src) ; } loadScript("answertip.jsp","answertipScript",null,params); } this.Personalize = Personalize; function FireQuery(search,top,left,fw,elem,topic,nohook,fc) { var mydoc = ANSW.isFirefoxExtension?window.content.document:document; if (ANSW.b5.isIE && document.readyState!="complete") return; var query = encodeURIComponent(search); if (typeof topic != "undefined" && topic!=null && topic!='') topic = encodeURIComponent(topic); var focusword= getFocusWord(query,fw); if (ANSW.isFirefoxExtension) { ANSW.Balloon.prototype.answersURL= "http://" + ANSW.server; ANSW.Balloon.prototype.JSBalloonPath=ANSW.Balloon.prototype.answersURL; } this.Show({title:'', top:top,left:left,query:focusword,nafid:ANSW.nafid,cobrand:ANSW.cobrand,nohook:nohook,parent:elem,ads:ANSW.ads}); if (isBoolPrefEnabled("javascript.enabled")) ensureScriptIsLoaded(query,fw,elem,ANSW.nafid,topic,ANSW.cobrand,fc); else { var answertipCss = mydoc.getElementById("answertipCSS"); if (typeof answertipCss == "undefined" || answertipCss==null) { loadCSS(mydoc); } var answertip = mydoc.getElementById("Answertip"); answertip.innerHTML= 'You need to enable Javascript to have this feature working. Hit ESC to close the AnswerTip.'; } } this.FireQuery = FireQuery; function getFocusWord(search,fw) { if (fw<0) return search; else { var trimmed = ANSW.trim(search); var arrFW = trimmed.split(" "); if ((arrFW.length-1)>=fw) return arrFW[fw]; else return search; } } function isBoolPrefEnabled(pref) { if (ANSW.isFirefoxExtension) { var preferencesService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService); return preferencesService.getBoolPref(pref); } else return true; } function ensureScriptIsLoaded(query,fw,elem,nafid,topic,cobrand,fc) { var mydoc= ANSW.isFirefoxExtension ? window.content.document : document; if (elem) { mydoc = elem.parentNode; mydoc= mydoc.parentNode; ANSW.doc = mydoc; } if (ANSW.doc) mydoc=ANSW.doc; var answertipJS = mydoc.getElementById("answertipScript"); var answertipCss = mydoc.getElementById("answertipCSS"); var answertipSound = mydoc.getElementById("answertipSound"); var head = mydoc.getElementsByTagName("head")[0]; var script; var scriptSound; var local=""; var src=""; script = mydoc.createElement('script'); script.id = 'answertipScript'; script.type = 'text/javascript'; if (ANSW.isFirefoxExtension) ANSW.b5.answersURL= "http://" + ANSW.server; if (ANSW.b5.answersURL.indexOf(":8080")!= -1) local = "/answers" src = ANSW.b5.answersURL + local + "/main/answertip.jsp?"; if (typeof topic != "undefined" && topic!=null && topic!='') src +="tname=" +topic; // s was already passed to the ads else src +="s=" +query; src += "&fw="+fw; if (fc>=0) src += "&fc="+fc; if (ANSW.isFirefoxExtension) src +="&o=0&gwp=22"; else src +="&o=2&gwp=21"; var encoding = (document.charset ? ("&encoding=" + document.charset) : ""); src += encoding; if (typeof nafid != "undefined" && nafid!=null && nafid!='') src +="&nafid=" +nafid; if (typeof cobrand != "undefined" && cobrand!=null && cobrand!='') src +="&cobrand=" +cobrand; if(!ANSW.isFirefoxExtension) src += "&ats="+encodeURIComponent(location.href); if (typeof ANSW.version!="undefined" && ANSW.version!="") src += "&ver="+ANSW.version; if (typeof ANSW.ads!="undefined" && ANSW.ads!=0) src += "&as="+ANSW.ads; if (typeof ANSW.adw!="undefined" && ANSW.adw!=0) // ad width src += "&adw="+ANSW.adw; if (typeof ANSW.adh!="undefined" && ANSW.adh!=0) //ad height src += "&adh="+ANSW.adh; if (typeof ANSW.aic!="undefined" && ANSW.aic!=0) // ad in content for aic=1, no ad in content aic=2 src += "&aic="+ANSW.aic; if (typeof ANSW.afid!="undefined" && ANSW.afid!="") // pass an afid src += "&afid="+ANSW.afid; var ord=Math.random()*10000000000000000; src += "&ord="+ord; // fix case 12685 script.src = src; if (answertipJS) { if (ANSW.b5.isIE) answertipJS.src = src; else head.replaceChild(script,answertipJS); } else head.appendChild(script); var sPron= mydoc.getElementById("sPron"); if (!sPron) sPron = mydoc.getElementById("sSpan"); if (!sPron) sPron = mydoc.getElementsByTagName("bgsound")[0]; if (!(answertipSound) && !(sPron)){ scriptSound = mydoc.createElement('script'); scriptSound.id = 'answertipSound'; scriptSound.type = 'text/javascript'; scriptSound.src =ANSW.b5.JSBalloonPath + "/main/lookup/sound.js"; head.appendChild(scriptSound); } if (typeof answertipCss == "undefined" || answertipCss==null) { loadCSS(mydoc); } if (typeof cobrand != "undefined" && cobrand!=null && cobrand!='') { var answertipCssCobrand = mydoc.getElementById("answertipCSS"+cobrand); if (typeof (answertipCssCobrand ) == "undefined" || answertipCssCobrand==null) { if (cobrand=='cbs') loadSingleCSS('http://www.cbsnews.com/common/css/v2_main.css','answertipCSS'+cobrand,mydoc); else loadSingleCSS('web_tip_'+cobrand +'.css','answertipCSS'+cobrand,mydoc); } } } function loadCSS(mydoc) { loadSingleCSS('web_tip.css','answertipCSS',mydoc); } this.loadCSS = loadCSS; function loadSingleCSS(filename,id,mydoc) { var head = mydoc.getElementsByTagName("head")[0]; var css; var local = "" css = mydoc.createElement('link'); css.type = 'text/css'; css.rel = 'stylesheet'; if (filename.indexOf("http://")==0) css.href = filename; else css.href = ANSW.b5.JSBalloonPath + "/main/lookup/" +filename; css.id = id; head.appendChild(css); } this.loadSingleCSS = loadSingleCSS; function loadSingleScript(filename,id,mydoc) { var head = mydoc.getElementsByTagName("head")[0]; var answersautotip = mydoc.getElementById("answersautotip"); if (typeof answersautotip == "undefined" || answersautotip==null) { var script; script = mydoc.createElement('script'); script.type = 'text/javascript'; if (filename.indexOf("http://")==0) script.src = filename; else script.src = ANSW.b5.JSBalloonPath + "/main/lookup/" +filename; script.id = id; head.appendChild(script); } } this.loadSingleScript = loadSingleScript; function loadScript(filename,id,pathParm,params) { if (pathParm==null){ pathParm = ANSW.b5.JSBalloonPath; if (pathParm.indexOf(":8080")!= -1) pathParm += "/answers" } var mydoc= ANSW.isFirefoxExtension ? window.content.document : document; var scriptNode = mydoc.getElementById(id); var head = mydoc.getElementsByTagName("head")[0]; var script; script = mydoc.createElement('script'); script.type = 'text/javascript'; script.src = pathParm + "/main/" +filename; var encoding = (document.charset ? ("encoding=" + document.charset) : ""); if (encoding!="") { if (params && typeof params!="undefined") params +="&"+encoding; else params="?"+encoding } script.src += params; script.id = id; if (scriptNode) { if (ANSW.b5.isIE) scriptNode.src = script.src; else head.replaceChild(script,scriptNode); } else head.appendChild(script); return false;// the jsp will turn it true if needed } this.loadScript = loadScript; function checkall(field,checkflag) { if (checkflag) { for (i = 0; i < field.length; i++) { field[i].checked = true;} } else { for (i = 0; i < field.length; i++) { field[i].checked = false; } } } this.checkall=checkall; function checklang(checkflag) { var mydoc= ANSW.isFirefoxExtension ? window.content.document : document; var field=mydoc.getElementsByName("tlang"); if (field!=null && typeof field!="undefined") { if (checkflag) { for (i = 0; i < field.length; i++) { field[i].checked = true;} } else { for (i = 0; i < field.length; i++) { field[i].checked = false; } } } } this.checklang=checklang; function getPrefs(form) { var mydoc= ANSW.isFirefoxExtension ? window.content.document : document; var prefs="&per=2"; var tabOrder=mydoc.getElementsByName("tabOrder"); var tlang=mydoc.getElementsByName("tlang"); if (form!=null && typeof form!="undefined") { tabOrder=form.tabOrder; tlang=form.tlang; } for (i=0, n=tabOrder.length; i<n; i++) { if (tabOrder[i].checked) { prefs+="&tabOrder="+ tabOrder[i].value; break; } } for (i=0, n=tlang.length; i<n; i++) { if (tlang[i].checked) { prefs+="&tlang="+ tlang[i].value; } } return prefs; } this.getPrefs=getPrefs; function onkeyup(ev) { if(!ev && window.event) { ev=window.event; } var keycode = ev.keyCode; if (keycode == 27) // esc { ANSW.b5.Hide(); } if (ANSW.isFirefoxExtension) { if ((keycode == 18 || keycode ==17)&& ANSW.leftbuttondown==true)//alt or ctrl { ANSW.leftbuttondown=false; ev.stopPropagation(); ev.preventDefault(); return false; } } if (ANSW.b5.isIE || ANSW.b5.isOpera) { if (ANSW.b5.oldkeyup) return ANSW.b5.oldkeyup() ; } } this.onkeyup = onkeyup; function mdown(ev) { if(ANSW.b5.isVisible()) { if(!ev && window.event) { ev=window.event; } var el = ANSW.b5.isIE ? ev.srcElement:ev.target; ANSW.b5.checkDown(ev,el); } if (ANSW.b5.isIE || ANSW.b5.isOpera) { if (ANSW.b5.oldmousedown) return ANSW.b5.oldmousedown() ; } } this.mdown = mdown; function checkDown(ev,elem) { var el = this.getReal(elem); if (ANSW.b5.isIE) { var sElem = ""; sElem = document.body.componentFromPoint( ev.clientX,ev.clientY) ; if (sElem.indexOf("scrollbar")==0) this.moveme_onmousedown(ev,el); else if (el.id==null ) { this.Hide(); } else if (el.id =="AnswersBalloon" || el.id=="AnswersSponsor") this.moveme_onmousedown(ev,el); else if (el.getAttribute("handlefor") == null || el.getAttribute("handlefor") == "") { this.Hide(); } else this.moveme_onmousedown(ev,el); } else { var mydoc = ANSW.isFirefoxExtension?window.content.document:document; // firefox has always the scrollbar on the right side even if dir==rtl if (mydoc.documentElement.scrollWidth<ev.pageX || mydoc.documentElement.scrollHeight<ev.pageY) { this.moveme_onmousedown(ev,el); } else if (typeof el=="undefined" || el==null || typeof el.id=="undefined" || el.id==null || el.id=='') { this.Hide(); } else if (el.id =="AnswersBalloon" || el.id=="AnswersSponsor") this.moveme_onmousedown(ev,el); else if (el.getAttribute("handlefor") == null || el.getAttribute("handlefor") == "") { this.Hide(); } else { this.moveme_onmousedown(ev,el); } } } this.checkDown = checkDown; var dragobject = null; var tx; var ty; var ie5 = document.all != null && document.getElementsByTagName != null; this.ie5 = ie5; function getReal(el) { temp = el; while ((temp != null) && (temp.tagName != "BODY") && (temp.tagName != "window")) { if ( temp.id==null || temp.id.indexOf("AnswersHandle")==0 || temp.id.indexOf("AnswersBalloon")==0 || temp.id.indexOf("AnswersSponsor")==0) { el = temp; break; } if (ANSW.b5.isIE) temp = temp.parentElement; else temp = temp.parentNode; } return el; } this.getReal = getReal; function moveme_onmousedown(ev,el) { var mydoc = ANSW.isFirefoxExtension?window.content.document:document; var tmp = null; if (typeof el !="undefined" && el && typeof el.getAttribute !="undefined"){ tmp = el.getAttribute("handlefor"); } if (tmp == null || tmp=='') { dragobject = null; return true; } else { dragobject = ANSW.doc ? ANSW.doc.getElementById(tmp) : mydoc.getElementById(tmp); if(ANSW.b5.isIE) { ANSW.b5.oldmousemove=document.onmousemove; document.onmousemove=ANSW.b5.moveme_onmousemove; } else { mydoc.addEventListener("mousemove",ANSW.b5.moveme_onmousemove,false); } } ty = ANSW.b5.isIE? ev.clientY - this.getTopPos(dragobject):ev.pageY - this.getTopPos(dragobject); tx = ANSW.b5.isIE? ev.clientX - this.getLeftPos(dragobject):ev.pageX - this.getLeftPos(dragobject); if (ANSW.b5.isIE) { ANSW.b5.ifrlayer.move(dragobject); ev.returnValue = false; ev.cancelBubble = true; } else { ANSW.b5.ifrlayer.move(dragobject); ev.stopPropagation(); ev.preventDefault(); return false; } } this.moveme_onmousedown = moveme_onmousedown; function moveme_onmouseup() { if(dragobject) { var mydoc = ANSW.isFirefoxExtension?window.content.document:document; dragobject = null; if(ANSW.b5.isIE) { document.onmousemove=ANSW.b5.oldmousemove; } else mydoc.removeEventListener("mousemove",ANSW.b5.moveme_onmousemove,false); } if (ANSW.b5.isIE || ANSW.b5.isOpera) { if (ANSW.b5.oldmouseup) return ANSW.b5.oldmouseup() ; } } this.moveme_onmouseup = moveme_onmouseup; function moveme_onmousemove(ev) { if (typeof dragobject!="undefined" && dragobject!=null) { if(!ev && window.event) { ev=window.event; } if (ANSW.b5.isIE) { if (ev.clientX >= 0 && ev.clientY >= 0) { dragobject.style.left = (ev.clientX - tx) + "px"; dragobject.style.top = (ev.clientY - ty) + "px"; ANSW.b5.ifrlayer.move(dragobject); } ev.returnValue = false; ev.cancelBubble = true; } else { if (ev.pageX >= 0 && ev.pageY >= 0) { dragobject.style.left = (ev.pageX - tx) + "px"; dragobject.style.top = (ev.pageY - ty) + "px"; ANSW.b5.ifrlayer.move(dragobject); } ev.stopPropagation(); ev.preventDefault(); return false; } } } this.moveme_onmousemove = moveme_onmousemove; function getLeftPos(el) { if (this.ie5 && !this.isOpera) { if (el.currentStyle.left == "auto") return 0; else return parseInt(el.currentStyle.left); } else { return this.isIE ? el.style.pixelLeft:parseInt(el.style.left); } } this.getLeftPos = getLeftPos; function getTopPos(el) { if (this.ie5 && !this.isOpera) { if (el.currentStyle.top == "auto") return 0; else return parseInt(el.currentStyle.top); } else { return this.isIE? el.style.pixelTop:parseInt(el.style.top); } } this.getTopPos = getTopPos; function onRightClick(ev) { if(!ev && window.event) { ev=window.event; } var el = ANSW.b5.isFirefox ? (ANSW.isFirefoxExtension ?ev.originalTarget:ev.target):ev.srcElement; var elem = ANSW.b5.getReal(el); if (elem && elem.id == "AnswersBalloon") { if (ANSW.b5.isFirefox) { ev.preventDefault(); ev.stopPropagation(); return false; } else { ev.returnValue = false; ev.cancelBubble = true; return false; } } if (ANSW.b5.isIE || ANSW.b5.isOpera) { if (ANSW.b5.oldcontextmenu) return ANSW.b5.oldcontextmenu(); } return true; } this.onRightClick = onRightClick; /* genere une iframe pour faire passer les divs par dessus des selects sous IE */ var ifrlayer = { make:function(obj) { if(!obj) return; obj = (typeof(obj)=="string" ) ? ANSW.doc.getElementById(obj) : obj; if(!obj) return; if( ANSW.doc.getElementById && !obj.iframelayer ) { if(obj.parentNode && !obj.iframelayer) var ifr = obj.parentNode.insertBefore(ANSW.doc.createElement("iframe" ), obj); { ifr.style.zIndex = parseInt(obj.style.zIndex)-1; } ifr.src = "javascript:;"; ifr.id="AnswersBalloonIframe"; with(ifr.style) { filter = "mask()"; position = "absolute"; } obj.iframelayer = ifr; } if (obj.iframelayer) { with(obj.iframelayer.style) { width = obj.offsetWidth+"px"; height = obj.offsetHeight+"px"; visibility = "visible"; backgroundColor="transparent"; border="none"; } ifrlayer.move(obj) ; } }, replace:function(obj) { if(!obj) return; obj = typeof(obj)=="string" ? ANSW.doc.getElementById(obj) : obj; if (!obj) return; if(!obj.iframelayer) { obj.iframelayer=ANSW.doc.getElementById("AnswersBalloonIframe"); } if (obj.iframelayer) { with(obj.iframelayer.style) { visibility = "visible"; } } ifrlayer.move(obj) ; }, hide:function(obj) { if(!obj) return; obj = typeof(obj)=="string" ?ANSW.doc.getElementById(obj) : obj; if (!obj) return; if(obj.iframelayer) { obj.iframelayer.style.visibility="hidden"; } }, move:function(obj) { if(!obj) return; obj = typeof(obj)=="string" ? ANSW.doc.getElementById(obj) : obj; if (!obj) return; if(obj && obj.iframelayer) { with(obj.iframelayer.style) { if (obj.direction && obj.direction.indexOf("N")>-1) top = obj.offsetTop+ 24 +"px"; else top = obj.offsetTop+"px"; left = obj.offsetLeft+"px" } } }, resize:function(obj) { if(!obj) return; obj = typeof(obj)=="string" ? ANSW.doc.getElementById(obj) : obj; if (!obj) return; if(obj && obj.iframelayer) { with(obj.iframelayer.style) { width = obj.offsetWidth+"px"; height = ANSW.doc.getElementById("popup_header") || ANSW.doc.getElementById("AnswersHeader_W")?"345px":"306px"; marginLeft="10px"; marginTop=ANSW.doc.getElementById("popup_header")?"0px":"10px"; } } } }; this.ifrlayer=ifrlayer; function SuppressFlash() { var selObjects=document.getElementsByTagName("EMBED"); for(var i=0;i<selObjects.length;i++) { if(selObjects[i].balloonMember!='true') { if(selObjects[i].style.visibility=='visible' || selObjects[i].style.visibility=='') { if(ObjectOverlap(ANSW.b5.balloonDIV, selObjects[i])) { selObjects[i].baloonHidden=true; selObjects[i].style.visibility='hidden'; } } } } selObjects=document.getElementsByTagName("OBJECT"); for(var i=0;i<selObjects.length;i++) { if(selObjects[i].balloonMember!='true') { if(selObjects[i].style.visibility=='visible' || selObjects[i].style.visibility=='') { if(ObjectOverlap(ANSW.b5.balloonDIV, selObjects[i])) { selObjects[i].baloonHidden=true; selObjects[i].style.visibility='hidden'; } } } } } this.SuppressFlash=SuppressFlash; function RestoreFlash() { var selObjects=document.getElementsByTagName("EMBED"); for(var i=0;i<selObjects.length;i++) { if(selObjects[i].baloonHidden) { selObjects[i].style.visibility='visible'; // Mark as ballonhidden selObjects[i].baloonHidden=false; } } selObjects=document.getElementsByTagName("OBJECT"); for(var i=0;i<selObjects.length;i++) { if(selObjects[i].baloonHidden) { selObjects[i].style.visibility='visible'; // Mark as ballonhidden selObjects[i].baloonHidden=false; } } } this.RestoreFlash=RestoreFlash; }; ANSW.parseString = function(string){ var queryArr = new Array(); if (string && string.length>0) { var tmpArr= string.split(";"); for (var i=0;i<tmpArr.length ;i++ ){ var index = tmpArr[i].indexOf('='); if (index>0) { queryArr[tmpArr[i].substring(0,index)]=tmpArr[i].substr(index+1); } } } return queryArr; } ANSW.initValues = function(arrValues){ for (var i in arrValues){ var j=i; if (i.indexOf("ANSW.")==0){ j = i.substr(5); } this[j]=arrValues[i]; } } ANSW.trim = function(string) { return string.replace(/^\s+/g, '').replace(/\s+$/g, ''); }; if (!ANSW.b5) { ANSW.server = "www.answers.com"; ANSW.isFirefoxExtension = false; ANSW.b5=new ANSW.Balloon(); ANSW.b5.initBalloon({width:490}); ANSW.version = "1.0"; ANSW.doc= ANSW.isFirefoxExtension ? window.content.document : document; ANSW.scripts = ANSW.doc.getElementsByTagName('script'); for (ANSW.index=0;ANSW.index< ANSW.scripts.length;ANSW.index++){ ANSW.src=ANSW.scripts.item(ANSW.index).src; if (ANSW.src && (ANSW.src.indexOf("webtip")>-1 || ANSW.src.indexOf("web_answertip.js")>-1 || ANSW.src.indexOf("answ_utils"))>-1) break; } ANSW.script = ANSW.scripts[ANSW.index]; ANSW.queryString =""; if (typeof ANSW.script != "undefined" && ANSW.script!=null) { ANSW.queryString = ANSW.script.src.replace(/^[^\?]+\??/,'').replace(/%27/g,"'"); if (ANSW.queryString){ ANSW.initValues(ANSW.parseString(ANSW.queryString)); } } else ANSW.answersURL="http://www.answers.com"; if (!ANSW.getJSHost){ ANSW.getJSHost=function(){ var host=null; var scripts = document.getElementsByTagName('script'); var re=/\s*(https?:\/\/[^\/]*)\//; for (var index=0;index<scripts.length;index++){ var src=scripts.item(index).src; if (src && (src.indexOf("webtip")>-1 || src.indexOf("web_answertip.js")>-1 || src.indexOf("answ_utils"))>-1) break; } if (src.match(re)) host = RegExp.$1; else host = location.protocol + "//" + location.host; if (host==null || host=="http://site.answers.com") host = "http://www.answers.com"; else if (host=="http://site1.answers.com") host = "http://stage1.answers.com"; return host; }; } if (ANSW.answersURL){ ANSW.Balloon.prototype.answersURL = ANSW.Balloon.prototype.JSBalloonPath = ANSW.answersURL; if (ANSW.JSBalloonPath) ANSW.Balloon.prototype.JSBalloonPath = ANSW.JSBalloonPath; } else if (!ANSW.Balloon.prototype.answersURL) { ANSW.host = ANSW.getJSHost(); ANSW.Balloon.prototype.answersURL = ANSW.host; if (ANSW.host == "http://www.answers.com") ANSW.Balloon.prototype.JSBalloonPath = "http://site.answers.com"; else ANSW.Balloon.prototype.JSBalloonPath = ANSW.host; } ANSW.Balloon.prototype.isOpera = (navigator.userAgent.toLowerCase().indexOf("opera") != -1); ANSW.Balloon.prototype.isFirefox = (navigator.userAgent.toLowerCase().indexOf("firefox") != -1); ANSW.Balloon.prototype.isIE = (navigator.userAgent.toLowerCase().indexOf("msie") != -1); ANSW.Balloon.prototype.isIE6 = ANSW.Balloon.prototype.isIE && navigator.appVersion && navigator.appVersion.indexOf("MSIE 6")!=-1; ANSW.Balloon.prototype.balloonDIV=0; if (ANSW.b5.isIE || ANSW.b5.isOpera) { ANSW.b5.oldkeyup = document.onkeyup; document.onkeyup=ANSW.b5.onkeyup; ANSW.b5.oldmousedown = document.onmousedown; document.onmousedown=ANSW.b5.mdown; ANSW.b5.oldmouseup = document.onmouseup; document.onmouseup= ANSW.b5.moveme_onmouseup; ANSW.b5.oldcontextmenu = document.oncontextmenu; document.oncontextmenu=ANSW.b5.onRightClick; } else { if (ANSW.isFirefoxExtension == false) { document.addEventListener("mousedown",ANSW.b5.mdown,false); document.addEventListener("mouseup",ANSW.b5.moveme_onmouseup,false); document.addEventListener("contextmenu",ANSW.b5.onRightClick,true); document.addEventListener("keyup",ANSW.b5.onkeyup,true); } } }